#include <iostream>
#include <string>
#include <memory>

class SubSystem1 {
    public:
    void DoSomeThing1() {
        std::cout << "DoSomeThing1" << std::endl;
    }
};

class SubSystem2 {
    public:
    void DoSomeThing2() {
        std::cout << "DoSomeThing2" << std::endl;
    }
};

class SubSystem3 {
    public:
    void DoSomeThing3() {
        std::cout << "DoSomeThing3" << std::endl;
    }
};

class Facade {
    public:
    ~Facade() {
        if(m_a_ != nullptr) {
            delete m_a_;
            m_a_ = nullptr;
        }
        if(m_b_ != nullptr) {
            delete m_b_;
            m_b_ = nullptr;
        }
        if(m_c_ != nullptr) {
            delete m_c_;
            m_c_ = nullptr;
        }
    }
    void DoSomething() {
        m_a_->DoSomeThing1();
        m_b_->DoSomeThing2();
    }
    private:
    SubSystem1* m_a_ = new SubSystem1();
    SubSystem2* m_b_ = new SubSystem2();
    SubSystem3* m_c_ = new SubSystem3();
};

int main() {
    std::cout << "hello facade pattern!!!" << std::endl;
    auto facade_ptr = std::make_unique<Facade>();
    facade_ptr->DoSomething();
    return 0;
}